/* SPDX-License-Identifier: GPL-2.0 */

#ifndef EULEROS_DIM_CORE_MEASURE_LOG_H
#define EULEROS_DIM_CORE_MEASURE_LOG_H

#include <linux/list.h>
#include "../common/dim_hash.h"

int dim_measure_log_init(void);

void dim_measure_log_uninit(void);

int dim_write_measure_log(char *path,
			  char *digest,
			  enum dim_hash_type hash_index);

/* return ctx */
struct list_head *dim_get_measure_log_first(void);
struct list_head *dim_get_measure_log_next(struct list_head *cur);

/* return address of line_buf, return NULL if no more lines or error */
char *dim_show_measure_log_by_node(struct list_head *cur,
				   char *line_buf,
				    size_t buf_len);

void dim_measure_log_prepare_for_baseline(void);

bool dim_measure_log_find_baseline(char *path,
				   char *digest,
				   enum dim_hash_type hash_index,
				   int search_all);

#endif /* EULEROS_DIM_CORE_MEASURE_LOG_H */
